package com.guigu.tankai.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.liuyunan.service.OrederService;
import com.guigu.tankai.pojo.Menu;
import com.guigu.tankai.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("Menu")
public class MenuController {
@Autowired
OrederService or;
    @Autowired
    MenuService menuService;

    @RequestMapping("menus")
    public List<Menu> menus(Integer id){
        return  menuService.Menus(id);
    }

    @RequestMapping("tkpagemenus")
    public PageInfo<Menu> pageEmp(Integer page, Integer num, Menu menu) {
     return menuService.findByMenu(page,num,menu);
    }
    @RequestMapping("tkdelmeu")
    public int deleteByPrimaryKey(Integer id) {
        return menuService.deleteByPrimaryKey(id);
    }
    @RequestMapping("tkAddmeu")
    public int insertSelective(Menu record) {
        return menuService.insertSelective(record);
    }
    @RequestMapping("tkselidu")
    public Menu selectByPrimaryKey(Integer id) {
        return menuService.selectByPrimaryKey(id);
    }
    @RequestMapping("tkupdmeu")
    public int updateByPrimaryKey(@RequestBody Menu menu) {
        return menuService.updateByPrimaryKey(menu);
    }


    @PostMapping ("tkfont")
    public int  tkfont() {
        return or.tkfont().size();
    }
    @PostMapping ("tkcount")
    public int  tkcount() {
        return or.tkcount().size();
    }
    @PostMapping ("tkcounto")
    public int tkcounto() {
        return or.tkcounto().size();
    }
}
